<?php
namespace plugin\videoappdownload\model; 
use think\Model;
use think\facade\Db; 
class PluginVideoappdownloadArticleLike extends Model
{
   
    
       public function is_exist($map)
     { 
     
         $finds = PluginVideoappdownloadArticleLike::where($map)->find();
         if ($finds) {
           return true;
         } 
         
          return false;
     }
  
 
     
      public function adds($request)
     { 
        $request['create_time'] =    time();
      
     	$request['create_ip']   =    request()->ip();
     	
     	$map['uid']         = $request['uid'];
     	$map['article_id']  = $request['id'];
        $is_exist=	 $this->is_exist($map);
        
     	 if (!$is_exist) {
               unset($request['id']);
               $adds = new PluginVideoappdownloadArticleLike;
               $adds->save($request); 
               return true;
     	 } 
     	 
        	  $this->dels($map);
        	  return false;
 
     }
 
 
 
       public function dels($map)
     {
  	  
  
       return  PluginVideoappdownloadArticleLike::where($map)->delete();
   
        
     }
     //模型方法


}